package com.xinchuang.controller.targetSystem.damage;

import com.baomidou.mybatisplus.annotation.TableField;
import com.xinchuang.comment.R;
import com.xinchuang.common.Result;
import com.xinchuang.dto.DeleteDto;
import com.xinchuang.service.targetSystem.damage.IHsCalculateStandardService;
import com.xinchuang.vo.HsCalculateStandardVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description: HS计算标准
 * @Author: zhb
 */
@RestController
@RequestMapping("/hsCalculateStandard")
@RequiredArgsConstructor
@Api(value = "HS计算标准", tags = "HS计算标准")
public class HsCalculateStandardController {

    private final IHsCalculateStandardService hsCalculateStandardService;

    /**
     * 获取HS计算标准列表接口
     *
     * @param pageNum
     * @param pageSize
     * @param targetTypeId required = false
     * @return
     */
    @GetMapping("/getList")
    @ApiOperation("获取HS计算标准列表接口")
    public R getList(@RequestParam(value = "pageNum") int pageNum,
                     @RequestParam(value = "pageSize") int pageSize,
                     @RequestParam(value = "targetTypeId") String targetTypeId,
                     @RequestParam(value = "hurtLevel", required = false) String hurtLevel,
                     @RequestParam(value = "destroyLevel", required = false) String destroyLevel) {
        return hsCalculateStandardService.selectEntities(pageNum, pageSize, targetTypeId, hurtLevel, destroyLevel);
    }

    /**
     * 增加或修改HS计算标准接口
     *
     * @param form
     * @return
     */
    @PostMapping("/addOrUpdateEntity")
    @ApiOperation("增加或修改实体HS计算标准接口")
    public Result addOrUpdateEntity(@RequestBody HsCalculateStandardVo form) {
        return hsCalculateStandardService.addOrUpdateEntity(form);
    }

    /**
     * 删除HS计算标准接口
     *
     * @return
     */
    @DeleteMapping("/delEntity")
    @ApiOperation("删除HS计算标准接口")
    public R delEntity(
            @RequestParam(value = "deleteStatus") Boolean deleteStatus,
            @RequestParam(value = "ids[]") String ids
    ) {
        return hsCalculateStandardService.deltEntities(ids, deleteStatus);
    }
}
